#用于控制一连串事件
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time

driver_path=r"F:\demos\chromedriver_win32\chromedriver.exe"
driver=webdriver.Chrome(executable_path=driver_path)
driver.get('https://www.baidu.com/')

#拿到输入框和点击框
inputTag=driver.find_element_by_id('kw')
submitBtn=driver.find_element_by_id('su')
#执行获取，点击，提交
#首先定义一个actions类，然后通过驱动driver从里面拿
actions=ActionChains(driver)
actions.move_to_element(inputTag)
actions.send_keys_to_element(inputTag,'python')
actions.move_to_element(submitBtn)
actions.click(submitBtn)
actions.perform()